import numpy as np
import cv2 as cv 
import matplotlib.pyplot as plt
#图像嵌在jupyter Notebook 网页中当前cell下显示
# %matplotlib inline
img = cv.imread('./img/2.jpg',cv.IMREAD_COLOR)
#转换为灰度图像
img_gray = cv.cvtColor(img,cv.COLOR_BGR2GRAY)
#show
plt.figure(figsize=(16,8))#设置窗口大小
plt.suptitle('Multi image display')#show in Color
plt.subplot(1,3,1);plt.imshow(img[:,:,::-1])
plt.title('RGB color image')
plt.axis('off')#不显示轴线和标签
#显示灰度图像被渲染成fack彩色图像
plt.subplot(1,3,3);plt.imshow(img_gray,vmin=0,vmax=255)
plt.title('pseudo-color image')#set son img title
plt.axis('off')#
plt.tight_layout()#自动调整子图参数使之fill
plt.show()